//
//  HSYUploadShopPhotosRequest.m
//  HSY
//
//  Created by 陈浩 on 2017/4/6.
//  Copyright © 2017年 金开门. All rights reserved.
//

#import "HSYUploadShopPhotosRequest.h"

@implementation HSYUploadShopPhotosRequest

- (NSString *)serviceCode{
    return API_SERVICE_CODE_UPLOAD_SHOP_PHOTOS;
}

- (NSDictionary *)requestData{
    NSAssert(self.shopId.length > 0, @"店铺id不能为空");
    
    NSMutableDictionary *params = [@{} mutableCopy];
    params[@"id"] = self.shopId;
    params[@"fileA"] = @"STOREFRONT";
    params[@"fileB"] = @"COUNTER";
    params[@"fileC"] = @"INDOOR";
    
    return params;
}

- (NSArray<HSYFileModel *> *)files{
    NSMutableArray *arr = [@[] mutableCopy];
    
    [self addFile:self.fileA withFileName:@"fileA" toArray:arr];
    [self addFile:self.fileB withFileName:@"fileB" toArray:arr];
    [self addFile:self.fileC withFileName:@"fileC" toArray:arr];
    
    return arr.count > 0 ? [arr copy] : nil;
}

- (void)addFile:(NSData *)file withFileName:(NSString *)fileName toArray:(NSMutableArray *)array{
    if (file) {
        HSYFileModel *model = [[HSYFileModel alloc] init];
        model.fileData = file;
        model.suffix = @"jpg";
        model.fileType = fileName;
        model.mimeType = @"image/png";
        
        [array addObject:model];
    }
}

- (BOOL)fileUplaod{
    return YES;
}


@end
